<template>
  <div class="home">
    home
    <button @click="add">增加</button>
    <p>{{this.$store.state.num}}</p>
    <p>{{num}}</p>
    <router-link to="/city"><button>{{this.$store.state.city}}</button></router-link>
  </div>
</template>

<script>
export default {
  name: 'Home',
  methods: {
    add(){
      this.$store.dispatch("addNum")
    }
  },
  computed:{
    num(){
      return this.$store.state.num
    }
  }
}
</script>
